package Prototype_mode.Sale;

import java.io.*;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class Customer implements Serializable,Cloneable{
    private Address address;

    public void setAddress(Address address) {
        this.address = address;
    }

    public Address getAddress() {
        return address;
    }
    public Customer deepClone() throws IOException,ClassNotFoundException, OptionalDataException{
        ByteArrayOutputStream bao=new ByteArrayOutputStream();
        ObjectOutputStream oss=new ObjectOutputStream(bao);
        oss.writeObject(this);
        ByteArrayInputStream bis =new ByteArrayInputStream(bao.toByteArray());
        ObjectInputStream ois=new ObjectInputStream(bis);
        return (Customer)ois.readObject();
    }
    public Customer clone(){
        Object obj=null;
        try{
            obj=super.clone();
            return (Customer)obj;
        }
        catch (CloneNotSupportedException e){
            System.out.println("失败");
            return null;
        }
    }
}
